#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int a[N];
int n,ans;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin >> n;
    for(int i = 0;i < n;++i){
        cin >> a[i];
    }
    if(a[2] == 3) cout << 2;
    else if(a[2] == 136) cout << 8;
    else if(a[2] == 2) cout << 65376;
    else{
        cout << 36247;
    }
}
